var Event = require('events'),
    emitter = new Event.EventEmitter();


var connectHandler = function() connected {
    console.log("连接成功");
    emitter.emit('received');
}


emitter.on('connection', connectHandler);

emitter.on('received', function() {
    console.log('数据接收成功');
});


emitter.emit('connection');


// var connected = function connectedtest() {
//     console.log('-->?connected');
// }
//
// function main(fn) {
//     fn();
// }
//
// main(connected);
//
//
